<template>
    <div class="wrap">
        <head-title :title="headText" @callback="onClickLeft"></head-title>
        <div class="user_bag wrapbd">
            <cell-group>
                <!--<cell title="姓名" is-link :value="nick" url='#/revisenickname'/>-->
                <!--<cell title="登录密码" is-link url='#/revisePassword?type=1' />-->
                <!--<cell title="支付密码" is-link url='#/revisePassword?type=2' />-->
                <cell title="收货地址" is-link url='#/addressList'/>
                <!--<cell title="更换手机号" :value="phone" is-link url='#/reviseMobile'/>-->
            </cell-group>
            <cell-group class="mrigin_t">
                <!--<cell title="更新地址" is-link url='#/settingdown'/>-->
                <cell title="公告信息" is-link url='#/notice'/>
                <cell title="关于我们" is-link url='#/about'/>
            </cell-group>
            <cell-group class="mrigin_t">
                <cell title="退出登录" is-link  @click="logout()"/>
            </cell-group>
        </div>
        <tabbar :num ="num"></tabbar>
    </div>
</template>
<script>
    import HeadTitle from "./../../components/title.vue";
    import tabbar from "./../../components/tabbar.vue";
    import { Cell, CellGroup, Dialog } from 'vant';
    export default {
        data(){
            return {
                headText:'设置',
                nick:'',
                phone:'',
                num: 3,
            }
        },
		mounted(){
            this.initialize() //拉取信息
		},
        methods:{
            onClickLeft() {
                this.$router.push('/user')
            },
            //获取用户信息
            initialize(){
                let _this = this;
				this.Tools.AXIOS({
                    url: 'user/index',
                    success: function (res) {
                        let result = res.data.data
                        _this.nick = result.nick_name;
                        _this.phone = result.moble;
                    }
                })
            },
            //退出登录
            logout(){
                Dialog.confirm({
                title: '温馨提示',
                message: '确定退出登录？'
                }).then(() => {
                    this.Tools.removeLocalStorageData();
                    this.$router.push('/login')
                });
            }
        },
		components: {
            HeadTitle,
            tabbar,
            Cell,
            CellGroup,
            Dialog
		},
    }
</script>
<style scoped>
.user_t{ width: 100%; padding: .8rem 0; background: #44B855;}
.user_t .ts{ width: 50%; display: flex;}
.user_t .ts i{ width: 1.3rem; height: 1.3rem; margin: 0 .3rem; background: #fff; border-radius: 100px; display: block; overflow: hidden;}
.user_t .ts span{ font-size: .4rem; line-height: 1.3rem; color: #fff;}
.mrigin_t{ margin-top: .5rem;}
</style>

